{ext->class_function class="comment" assign="is_comment"}
{if $is_comment == 1}

<script language="javascript1.4" type="text/javascript">
var sCommentDeleteConfirm		=new Array();
	sCommentDeleteConfirm[1]	='{t t='Ar tikrai norite ištrinti šį komentarą?'}';
	sCommentDeleteConfirm[2]	='{t t='Ar tikrai norite ištrinti visus šio elemento komentarus?'}';	
	sCommentDeleteConfirm[3]	='{t t='Ar tikrai norite ištrinti visus šio puslapio komentarus?'}';
	sCommentDeleteConfirm[4]	='{t t='Ar tikrai norite ištrinti *visus* komentarus?'}';
{literal}
	function toggle_comment(sId){
		oElement=document.getElementById(sId);
		if(oElement.className=='comment hidden') oElement.className='comment visible'
		else oElement.className='comment hidden'		
	}	
	
	function delete_comment(nMode, sFormName, nId, nType){		
		if (nMode==1) 		sMode='delete_by_comment_id';
		else if (nMode==2) 	sMode='delete_by_parent';
		else if (nMode==3)	sMode='delete_by_page';	
		else if (nMode==4)	sMode='delete_all';		
		
		if(!confirm(sCommentDeleteConfirm[nMode])) return false;
		
		document.forms[sFormName].act.value=sMode;		
		
		if (nMode==1) 		document.forms[sFormName].comment_id.value=nId;
		else if (nMode==2) 	{
							document.forms[sFormName].parent.value=nId;
							document.forms[sFormName].type.value=nType;
		}
		else if (nMode==3)	document.forms[sFormName].page.value=nId;	

		document.forms[sFormName].submit();
	}
	
{/literal}
</script>

<form name="delete_comments" enctype="multipart/form-data" method="post">
	<input name="admin" type="hidden" value="1">
	<input name="module" type="hidden" value="comment">
	<input name="referer" type="hidden" value="{ext->get_referer}">
	
	<input name="act" type="hidden" value="">	
	
	<input name="page" type="hidden" value="">
	<input name="parent" type="hidden" value="">
	<input name="type" type="hidden" value="">
	<input name="comment_id" type="hidden" value="">
</form>

<span class="comments">
	<div class="holder">
		{if !$smarty.get.tpl_page_id && !$smarty.get.tpl_element_id}
			
			{ext->class_function class="comment" func="get_all_pages" assign="all_pages"}		
			{ext->countArray array=$all_pages assign="commented_elements_length"}
			
			{if $commented_elements_length}			
				{include file="admin/modules/comment/menu_list.html"}
				{include file="admin/modules/comment/page_list.html"}
				{include file="admin/modules/comment/menu_list.html"}
			{else}
				<div style="padding:7px 0">
				<div style="border:1px solid #000; border-width:1px 0; height:50px; background-color:#fff; line-height:50px; text-align:center">{t t='Komentarų nėra'}</div>
				</div>
			{/if}
			
		{elseif $smarty.get.tpl_page_id && !$smarty.get.tpl_element_id}
			
			{ext->get_page_info id=$smarty.get.tpl_page_id assign="selected_page_data"}			
			{ext->class_function class="comment" func="get_all_elements_by_page_id" page=$smarty.get.tpl_page_id assign="commented_elements"}					
			
			{include file="admin/modules/comment/menu_list.html"}
			{include file="admin/modules/comment/elements_list.html"}
			{include file="admin/modules/comment/menu_list.html"}
			
		{elseif $smarty.get.tpl_page_id && $smarty.get.tpl_element_id}
			
			{ext->class_function class="comment" func="get_comments_by_page_id_parent_id_and_parent_type" parent=$smarty.get.tpl_element_id type=$smarty.get.tpl_element_type assign="coments"}	
			{ext->get_page_info id=$smarty.get.tpl_page_id assign="selected_page_data"}		
			
			{include file="admin/modules/comment/menu_list.html"}
			{include file="admin/modules/comment/comments_list.html"}
			{include file="admin/modules/comment/menu_list.html"}
			
		{/if}
	</div>
</span>		
{/if}
